runOnStartup(async runtime => {
    runtime.addEventListener("tick", () => tick())
    runtime.getLayout("MainLevel").addEventListener("afterlayoutstart", () => init())

});
function tick() {
    if (runtime.layout.name != "MainLevel") return;

}
function init() {
    game_recordtimescore.record()
}
globalThis.game_recordtimescore = {
    record: function () {
        if (playerSelfdata.playerHeart > 0) {
            var rec = setInterval(() => {
                // 计时
                playerSelfdata.LiveTime += 1
                playerSelfdata.Score += 30
                let time = playerSelfdata.LiveTime
                let Score = playerSelfdata.Score
                //console.log(time + "s", Score)
                if (playerSelfdata.playerHeart <= 0) {
                    clearInterval(rec)
                }
            }, 1000);
        }
    }
}
export default game_recordtimescore